function jianTuan(ev, ok) {
        if($("#createstoreform").valid() === true) {
                ev.stopPropagation();
                ok = (typeof ok != 'undefined') ? ok : false;
                if (ok) return true;
                $.blockUI({ message: $('#question_jianbaobei'), css: { width: '400px',height:'100px',border:'10px solid #999999'} });
                return false;
        }
}
$(document).ready(function() {

	var validator = $("#createstoreform").validate({
		rules: {
			storename: {
				required: true,
				minlength:1,
				maxlength:20
			},
			storeCategory: {
				required: true
			},
			price: {
				required: true
			},
			threshhold_num: {
				required: true
			},
			//description: {
		//		required: true,
		//		minlength:5,
		//		maxlength:2500,
		//		},
			bulletin: {
					required: true,
					minlength:5,
					maxlength:500
				},
			terms: "required"
		},
		messages: {
			storename: {
				required: "请输入商品名称",
				minlength: jQuery.format("请输入最少 {0} 个字符"),
				maxlength: jQuery.format("店名最多 {0} 个字符")
			},
			storeCategory: {
				required: "请选择分类"
			},
			price: {
				required: "请输入该商品价格"
			},
			threshhold_num: {
				required: "请输入最低参团人数"
			},
			bulletin: {
					required: "请输入公告牌",
					minlength: jQuery.format("请输入最少 {0} 个字符"),
					maxlength: jQuery.format("公告牌最多 {0} 个字符")
			},
			terms: " "
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			if ( element.is(":radio") )
				error.appendTo( element.parent().next().next() );
			else if ( element.is(":checkbox") )
				error.appendTo ( element.next() );
			else
				error.appendTo( element.parent().next() );
		},
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}
	});
	
        $('#createstoreform').bind('submit', jianTuan);
        $('#yes_baobei').click(function() {
		$('#createstoreform').trigger('submit', [true]);
			$.blockUI({ message: "<div style=\"margin-left:50px;flaot:left;margin-top:15px;font-size:14px;color:#999999;\">处理中...请不要关闭该页面！</div>" , css:{height:'50px',width:'400px',border:'10px solid #999999'}});
        });

        $('#no_baobei').click(function() {
                $.unblockUI();
                return false;
	});


});

